﻿//-----------------------------------------------------------------------
// <copyright file="TaskItem.cs" 
//        company="MicroMan6502">
//
//    Copyright (c)2010 MicroMan6502. All rights reserved.
//
// </copyright>
//-----------------------------------------------------------------------

namespace EasyThreading
{
    using System;

    /// <summary>
    /// Defines a class that stores information about a work item.
    /// </summary>
    internal class TaskItem
    {
        /// <summary>
        /// Gets or sets a value indicating whether or not the operation has completed.
        /// </summary>
        public TaskItemState ItemState { get; set; }

        /// <summary>
        /// Gets the method to call on the worker thread.
        /// </summary>
        public TaskCallback Callback { get; set;}

        /// <summary>
        /// Gets or sets the paramter for the task item.
        /// </summary>
        public object Parameter { get; set; }

        /// <summary>
        /// Instantiates a new instance of the TaskItem class.
        /// </summary>
        public TaskItem()
        {
            this.Reset();
        }

        /// <summary>
        /// Resets the stateof the object for the next item.
        /// </summary>
        public void Reset()
        {
            this.Callback = null;
            this.ItemState = TaskItemState.NotInUse;
            this.Parameter = null;
        }
    }
}
